Optimal. Leaf size=132 \[ \frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}-\frac {\left (a^2-b^2\right ) d (d \cot (e+f x))^{-1+n} \, _2F_1\left (1,\frac {1}{2} (-1+n);\frac {1+n}{2};-\cot ^2(e+f x)\right )}{f (1-n)}-\frac {2 a b (d \cot (e+f x))^n \, _2F_1\left (1,\frac {n}{2};\frac {2+n}{2};-\cot ^2(e+f x)\right )}{f n} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.16, antiderivative size = 132, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3754, 3624,
3619, 3557, 371} \begin {gather*} -\frac {d \left (a^2-b^2\right ) (d \cot (e+f x))^{n-1} \, _2F_1\left (1,\frac {n-1}{2};\frac {n+1}{2};-\cot ^2(e+f x)\right )}{f (1-n)}+\frac {a^2 d (d \cot (e+f x))^{n-1}}{f (1-n)}-\frac {2 a b (d \cot (e+f x))^n \, _2F_1\left (1,\frac {n}{2};\frac {n+2}{2};-\cot ^2(e+f x)\right )}{f n} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 371
Rule 3557
Rule 3619
Rule 3624
Rule 3754
Rubi steps
\begin {align*} \int (d \cot (e+f x))^n (a+b \tan (e+f x))^2 \, dx &=d^2 \int (d \cot (e+f x))^{-2+n} (b+a \cot (e+f x))^2 \, dx\\ &=\frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}+d^2 \int (d \cot (e+f x))^{-2+n} \left (-a^2+b^2+2 a b \cot (e+f x)\right ) \, dx\\ &=\frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}+(2 a b d) \int (d \cot (e+f x))^{-1+n} \, dx-\left (\left (a^2-b^2\right ) d^2\right ) \int (d \cot (e+f x))^{-2+n} \, dx\\ &=\frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}-\frac {\left (2 a b d^2\right ) \text {Subst}\left (\int \frac {x^{-1+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{f}+\frac {\left (\left (a^2-b^2\right ) d^3\right ) \text {Subst}\left (\int \frac {x^{-2+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{f}\\ &=\frac {a^2 d (d \cot (e+f x))^{-1+n}}{f (1-n)}-\frac {\left (a^2-b^2\right ) d (d \cot (e+f x))^{-1+n} \, _2F_1\left (1,\frac {1}{2} (-1+n);\frac {1+n}{2};-\cot ^2(e+f x)\right )}{f (1-n)}-\frac {2 a b (d \cot (e+f x))^n \, _2F_1\left (1,\frac {n}{2};\frac {2+n}{2};-\cot ^2(e+f x)\right )}{f n}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.50, size = 107, normalized size = 0.81 \begin {gather*} -\frac {d (d \cot (e+f x))^{-1+n} \left (-\left (\left (a^2-b^2\right ) n \, _2F_1\left (1,\frac {1}{2} (-1+n);\frac {1+n}{2};-\cot ^2(e+f x)\right )\right )+a \left (a n+2 b (-1+n) \cot (e+f x) \, _2F_1\left (1,\frac {n}{2};\frac {2+n}{2};-\cot ^2(e+f x)\right )\right )\right )}{f (-1+n) n} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.42, size = 0, normalized size = 0.00 \[\int \left (d \cot \left (f x +e \right )\right )^{n} \left (a +b \tan \left (f x +e \right )\right )^{2}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (d \cot {\left (e + f x \right )}\right )^{n} \left (a + b \tan {\left (e + f x \right )}\right )^{2}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n\,{\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^2 \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________